import pandas as pd
from pandas import DataFrame

lenth = len('https://shop.10086.cn/goods/100_100_')
print(lenth)
print('https://shop.10086.cn/goods/100_100_1073786_1056250.html'[36:])
# ptone = '18899969565'
# ptone.apply(func = lambda x : x.replace(x[3:7], '****'))
# print(ptone)
dd = pd.read_excel('移动套餐.xlsx',sheet_name='Sheet1')
# 添加一列
dd['url2'] = None
# 给这一列赋值（必须先添加这一列）
dd.url2 = dd.url.apply(func = lambda x : str(x)[36:])

# 删除gender列，需要指定axis为1，当删除行时，axis为0
# dd = dd.drop('url', axis=1)

dd.groupby('url2').sum()

# dd.to_excel('移动套餐2.xlsx')
DataFrame(dd).to_excel('移动套餐2.xlsx', sheet_name='Sheet1', index=False, header=True)
